import { Component, ViewChild } from '@angular/core';
import { ionicBootstrap, Platform, Nav } from 'ionic-angular';
import { StatusBar } from 'ionic-native';

import { Page1 } from './pages/page1/page1';
import { Page2 } from './pages/page2/page2';
import { HeroPage } from './pages/hero/hero';
import { HeroObservablePage } from './pages/hero-observable/hero-observable';

@Component({
  templateUrl: 'build/app.html'
})
class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage: any = HeroPage;

  pages: Array<{title: string, component: any}>;

  constructor(private platform: Platform) {
    this.initializeApp();

    // used for an example of ngFor and navigation
    this.pages = [
      { title: 'Page uno', component: Page1 },
      { title: 'Page dos', component: Page2 },
      { title: 'Heroes', component: HeroPage },
      { title: 'Heroes.Observable', component: HeroObservablePage }
    ];

  }

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
    });
  }

  doRefresh(refresher) {
    
  }

  openPage(page) {
    // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    this.nav.setRoot(page.component);
  }
}



// import { XHRBackend } from '@angular/http';
// import { InMemoryBackendService,
//          SEED_DATA }  from 'angular2-in-memory-web-api';
// import { HeroData }   from './hero-data';
// import { HTTP_PROVIDERS } from '@angular/http';

ionicBootstrap(MyApp)
// ionicBootstrap(MyApp, [
//     HTTP_PROVIDERS,
//     { provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
//     { provide: SEED_DATA,  useClass: HeroData }                // in-mem server data
// ]);
